namespace :session do
  
  desc "Clear session 30 min ago."
  task(:clear_overtime_session_bak => :environment) do
    puts "Clear session, time: #{30.minutes.ago.to_datetime.to_s}."
    ActiveRecord::SessionStore::Session.delete_all("updated_at <= \'#{1.minutes.ago.to_datetime.to_s}\'")
    #CurrentUser.delete_all("updated_at >= \'#{30.minutes.ago(Time.now).to_datetime.to_s}\'")
    puts "Clear finished."
  end
end